package com.lxl.commons.mapper.impl;

import com.lxl.commons.mapper.IMapper;
import com.lxl.workbench.entity.CategoryStaff;
import com.lxl.workbench.entity.CommonStaff;

import javax.servlet.jsp.jstl.sql.Result;
import java.util.ArrayList;
import java.util.List;

/**
 * 书目管理员的Result转化成List集合
 * @author 北上寻海
 */
public class CategoryStaffMapperImpl implements IMapper {
    @Override
    public List<CategoryStaff> mapper(Result result) {
        List<CategoryStaff> list = new ArrayList<>();
        if(result.getRowCount()!=0){
            for (int i = 0 ;i<result.getRowCount();i++){
                CategoryStaff categoryStaff =new CategoryStaff();
                categoryStaff.setId((String)result.getRowsByIndex()[i][0]);
                categoryStaff.setStaffName((String)result.getRowsByIndex()[i][1]);
                categoryStaff.setGender((String)result.getRowsByIndex()[i][2]);
                categoryStaff.setPhone((String)result.getRowsByIndex()[i][3]);
                categoryStaff.setManageType((String)result.getRowsByIndex()[i][4]);
                categoryStaff.setPermissions((String)result.getRowsByIndex()[i][5]);
                categoryStaff.setUserId((String)result.getRowsByIndex()[i][6]);
                list.add(categoryStaff);
            }
        }
        return list;
    }
}
